﻿@model MediaSettingsModel
@{
    ViewBag.Title = T("Admin.Configuration.Settings.Media").Text;
}
@using (Html.BeginForm())
{
    <div class="section-header">
        <div class="title">
            <i class="far fa-image"></i>
            @T("Admin.Configuration.Settings.Media")
        </div>
        <div class="options">
            <button type="submit" name="save" value="save" class="btn btn-warning">
				<i class="fa fa-check"></i>
				<span>@T("Admin.Common.Save")</span>
			</button>
        </div>
    </div>

    Html.RenderAction("StoreScopeConfiguration", "Setting");

    @Html.ValidationSummary(false)

    <table class="adminContent">
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.AutoGenerateAbsoluteUrls)
			</td>
			<td class="adminData">
				@Html.SettingEditorFor(model => model.AutoGenerateAbsoluteUrls)
				@Html.ValidationMessageFor(model => model.AutoGenerateAbsoluteUrls)
			</td>
		</tr>
		<tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.AvatarPictureSize)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.AvatarPictureSize, null, new { postfix = T("Common.Pixel").Text })
                @Html.ValidationMessageFor(model => model.AvatarPictureSize)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.ProductThumbPictureSize)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.ProductThumbPictureSize, null, new { postfix = T("Common.Pixel").Text })
                @Html.ValidationMessageFor(model => model.ProductThumbPictureSize)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.ProductThumbPictureSizeOnProductDetailsPage)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.ProductThumbPictureSizeOnProductDetailsPage, null, new { postfix = T("Common.Pixel").Text })
                @Html.ValidationMessageFor(model => model.ProductThumbPictureSizeOnProductDetailsPage)
            </td>
        </tr>
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.MessageProductThumbPictureSize)
			</td>
			<td class="adminData">
				@Html.SettingEditorFor(model => model.MessageProductThumbPictureSize, null, new { postfix = T("Common.Pixel").Text })
				@Html.ValidationMessageFor(model => model.MessageProductThumbPictureSize)
			</td>
		</tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.ProductDetailsPictureSize)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.ProductDetailsPictureSize, null, new { postfix = T("Common.Pixel").Text })
                @Html.ValidationMessageFor(model => model.ProductDetailsPictureSize)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.DefaultPictureZoomEnabled)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.DefaultPictureZoomEnabled)
                @Html.ValidationMessageFor(model => model.DefaultPictureZoomEnabled)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.AssociatedProductPictureSize)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.AssociatedProductPictureSize, null, new { postfix = T("Common.Pixel").Text })
                @Html.ValidationMessageFor(model => model.AssociatedProductPictureSize)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.BundledProductPictureSize)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.BundledProductPictureSize, null, new { postfix = T("Common.Pixel").Text })
                @Html.ValidationMessageFor(model => model.BundledProductPictureSize)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.CategoryThumbPictureSize)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.CategoryThumbPictureSize, null, new { postfix = T("Common.Pixel").Text })
                @Html.ValidationMessageFor(model => model.CategoryThumbPictureSize)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.ManufacturerThumbPictureSize)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.ManufacturerThumbPictureSize, null, new { postfix = T("Common.Pixel").Text })
                @Html.ValidationMessageFor(model => model.ManufacturerThumbPictureSize)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.CartThumbPictureSize)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.CartThumbPictureSize, null, new { postfix = T("Common.Pixel").Text })
                @Html.ValidationMessageFor(model => model.CartThumbPictureSize)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.CartThumbBundleItemPictureSize)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.CartThumbBundleItemPictureSize, null, new { postfix = T("Common.Pixel").Text })
                @Html.ValidationMessageFor(model => model.CartThumbBundleItemPictureSize)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.MiniCartThumbPictureSize)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.MiniCartThumbPictureSize, null, new { postfix = T("Common.Pixel").Text })
                @Html.ValidationMessageFor(model => model.MiniCartThumbPictureSize)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.MaximumImageSize)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.MaximumImageSize, null, new { postfix = T("Common.Pixel").Text })
                @Html.ValidationMessageFor(model => model.MaximumImageSize)
            </td>
        </tr>
		<tr>
			<td colspan="2">
				<div class="admin-config-group">
					<div class="title">
						@(T("Admin.Configuration.Settings.Media.MediaIsStoredIn"))&hellip;
					</div>
				</div>
				<div class="alert alert-warning">
					<p>
						@T("Admin.Configuration.Settings.Media.MoveMediaNote")
					</p>
					<p>
						@(T("Admin.Configuration.Settings.Media.CurrentStorageLocation")):
						<strong>@Model.StorageProvider</strong>
					</p>
				</div>
			</td>
		</tr>
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.StorageProvider)
			</td>
			<td class="adminData">
				@Html.DropDownListFor(model => model.StorageProvider, Model.AvailableStorageProvider)

				<button type="button" id="MoveMediaButton" class="btn btn-danger mt-3" data-url="@Url.Action("ChangeMediaStorage")">
					<i class="fa fa-fw fa-cogs"></i>
					<span>@(T("Admin.Common.MoveNow"))!</span>
				</button>

				@Html.ValidationMessageFor(model => model.StorageProvider)			
			</td>
		</tr>
    </table>
}

<script type="text/javascript">
    jQuery(document).ready(function () {

    	// Move media.
    	$('#MoveMediaButton').click(function () {
    		if (confirm(@T("Admin.Common.AskToProceed").JsText)) {

    			$.throbber.show({
    				speed: 0,
    				message: @T("Admin.Common.WaitProcessingMessage").JsText
    			});

    			$(this).doPostData({
    				data: { targetProvider: $('#@Html.FieldIdFor(model => model.StorageProvider)').val() }
    			});
    		}
    	});
    });
</script>